require 'test/unit'
require 'watir'
require 'rubygems'

include Watir
class TestSuite < Test::Unit::TestCase
  
  def setup
    @b ||= Watir::IE.new    
     # @b.speed = :fast
     # @b.maximize
     # @b.bring_to_front
  end
  
  def teardown
    @b.close
  end
  
  def test_0101
    # Q. How do I scroll the browser down?
     @b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0101.html')
     @b.link(:text, 'justaddwatir').document.scrollintoview 
  end
  def test_0102
    #Q. How do I find the selected element in a combo box?    
    @b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0102.html')
    combo_items = @b.select_list(:name, "watirCombo").getSelectedItems
    puts combo_items
  end
  def test_0103
    #Q. How do I enter text in a text box   
    @b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0103.html')
    @b.text_field(:name, "comments").set("just_add_watir rocks!")
  end
  def test_0104
    #Q. How do I check/uncheck a checkbox?
    @b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0104.html')
    @b.checkbox(:name, "checkbox").set(true)
    @b.checkbox(:name, "checkbox").set(false)
  end
  def test_0105
    #Q. How do I click a radio button
    @b.goto('http://justaddwatir.com/watir/test_html/tc_0101_0200/test_0105.html')
    @b.radio(:name,"group1").set
  end
end

